/*
 * @Author: hrg
 * @Date: 2024-01-23 09:38:25
 * @LastEditTime: 2024-01-23 11:49:11
 * @FilePath: \study_go\study06_gin\gin_demo04\main.go
 * @Description:URL参数
 */
package main

import (
	"fmt"
	"net/http"

	"github.com/gin-gonic/gin"
)

func main() {

	r := gin.Default()

	r.GET("/user", func(c *gin.Context) {

		// 指定默认值
		name := c.DefaultQuery("name", "默认值")
		// 不指定默认值
		// name := c.Query("name")

		c.String(http.StatusOK, fmt.Sprintf("你好啊，%s", name))

	})

	r.Run(":8000")
}
